#pragma once

#include <gio/gio.h>
#include <object_v2/object_v2-string.h>

G_BEGIN_DECLS

#define DEFAULT_EVENT_SERVER "39.98.215.31"
#define DEFAULT_EVENT_PORT   5678

#define EVENT_TYPE_CLIENT    (event_client_get_type())
G_DECLARE_FINAL_TYPE(EventClient, event_client, EVENT, CLIENT, GObject)

typedef enum _EventRequestType
{
        EVENT_REQUEST_TYPE_QUERY,
        EVENT_REQUEST_TYPE_INSERT,
        EVENT_REQUEST_TYPE_REMOVE,

        EVENT_REQUEST_TYPE_NONE,

} EventRequestType;

extern EventClient *event_client_new();

/**
 * @brief 设置用户名和密码
 */
extern void event_client_set_user_info(EventClient *self,
                                       const char  *user_class,
                                       const char  *user_name,
                                       const char  *user_password);

/**
 * @brief 设置操作条件
 */
extern void event_client_set_request_option(EventClient *self,
                                            const char  *item_date,
                                            const char  *item_title,
                                            const char  *item_content);

/**
 * @brief 发送请求并获取服务器的回复信息
 */
extern ObjectString *event_client_send_request(EventClient     *self,
                                               EventRequestType request_type);

/**
 * @brief 尝试从本地载入默认用户配置信息
 */
extern gboolean event_client_read_local_user_info(EventClient *self);

G_END_DECLS
